import os
# print(os.getcwd())
# os.mkdir('os_test')
# os.chdir('os_test')
# os.mkdir('mk_test')
# f = open('1.txt','w')
# f.close()
# os.rename('1.txt','2.txt')
# os.chdir('C:\\Users\\Administrator\\PycharmProjects\\pythonProject')
# print(os.listdir('os_test'))
# os.rmdir('os_test\\mk_test')
# print(os.listdir('os_test'))
# os.remove('os_test\\2.txt')
# print(os.listdir('os_test'))

os.mkdir('语文')
os.chdir('语文')
data_list = ['语法','诗词','古文','写作','外国文学']
for data in data_list:
    filename = data + '.txt'
    file = open(filename,'w')
    file.close()
path = os.getcwd()
print(os.listdir(path))
os.remove('外国文学.txt')
file_mame = os.listdir(path)
print(file_mame)
i = 1
for name in file_mame:
    if '.txt' in name:
        new_name = str(i) + name
        os.rename(name,new_name)
        i += 1
print(os.listdir(path))

